package com.jzoom.zoom.admin.controllers;

import com.jzoom.zoom.admin.daos.RoleDao;
import com.jzoom.zoom.dao.Page;
import com.jzoom.zoom.dao.Record;
import com.jzoom.zoom.web.annotations.Controller;
import com.jzoom.zoom.web.annotations.JsonResponse;
import com.jzoom.zoom.web.annotations.Mapping;
import com.jzoom.zoom.web.annotations.Param;
import com.jzoom.zoom.web.exception.StatusException;

import java.util.List;
import java.util.Map;

@Controller(key = "")
public class RoleController extends BaseDaoController<RoleDao> implements AdminController {


    @Mapping(value = "sys/sys_role/index", method = {Mapping.POST})
    @JsonResponse
    public Page<Record> index(@Param(name = "@") Map<String, Object> params) {
        return model.getPage(params);
    }


    @Mapping(value = "sys/sys_role/list", method = {Mapping.POST})
    @JsonResponse
    public List<Record> list(
            @Param(name = "{ds}") String ds,
            @Param(name = "{module}") String module,
            @Param(name = "@") Map<String, Object> params) throws StatusException.NotFoundException {
        return model.getList(params);
    }
}
